<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let z = 10;
      let n = 0;

      let sum = 0; //存储累加结果

      for (let i = 0; i <= z; i++) {
        if (n == 3) {
          sum += i; //sum = sum + i;
          n = 0;
        }
        n++;
      }

      console.log(sum);
    </script>
  </body>
</html>
